<template>
  <ul class="catagtory">
    <li
      :class="{ select: currentCategory === item.id }"
      v-for="(item, index) in category"
      :key="index"
      @click="$store.commit('category/updateCurrentCategory', item.id)"
    >
      {{ item.name }}
    </li>
  </ul>
</template>

<script>
import { mapGetters } from 'vuex'
export default {
  data () {
    return {}
  },
  computed: {
    ...mapGetters(['category', 'currentCategory'])
  },
  created () {
    this.$store.dispatch('category/getCategory')
  }
}
</script>

<style>
</style>
